/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.muni.fi.pa165.musiclibrary.api.transfers;

import cz.muni.fi.pa165.musiclibrary.api.dto.AlbumDTO;
import cz.muni.fi.pa165.musiclibrary.api.entities.Album;

/**
 *
 * @author Dominik
 */
public class AlbumT {
    public static AlbumDTO AlbumToDTO(Album album){
        if (album == null) {
            throw new IllegalArgumentException();
        }
        AlbumDTO albumDTO = new AlbumDTO();
        
        albumDTO.setId(album.getId());
        albumDTO.setName(album.getName());
        albumDTO.setAlbumArt(album.getAlbumArt());
        albumDTO.setComment(album.getComment());
        albumDTO.setReleaseDate(album.getReleaseDate());
                
        return albumDTO;        
    } 

    public static Album DTOtoAlbum(AlbumDTO albumDTO){
        if (albumDTO == null) {
            throw new IllegalArgumentException();
        }
        Album album = new Album();
        
        album.setId(albumDTO.getId());
        album.setName(albumDTO.getName());
        album.setAlbumArt(albumDTO.getAlbumArt());
        album.setComment(albumDTO.getComment());
        album.setReleaseDate(albumDTO.getReleaseDate());
                
        return album;        
    }     
}
